.html_title= @html_title
= html_buttons do
  /= link_to '新增 User', new_user_path, class: 'btn btn-xs btn-primary'

/! 搜索表单
.search_form
  = search_form_for(@search, builder: SimpleForm::FormBuilder, class: "index_search_form") do |f|
    .pull-left.push-10-l= per_page_select
    = f.input_field :uid_eq, placeholder: (User.t :uid), class: "form-control"
    = f.input_field :login_cont, placeholder: (User.t :login), class: "form-control"
    = f.input_field :name_cont, placeholder: (User.t :name), class: "form-control"
    = f.input_field :school_id_eq, collection: School.options_for_select, include_blank: (User.t :school_id), class: "form-control"
    = f.input_field :trainee_title_id_eq, collection: Trainee::Title.options_for_select, include_blank: (User.t :trainee_title_id), class: "form-control"
    = search_button f
.radius-block
  /! 数据列表
  table.index-data-table
    thead
      tr
        th style="width: 200px" = User.t :name
        th= User.t :active
        th= User.t :uid
        th= User.t :school_id
        th= User.t :school_ids
        th= User.t :trainee_title_id
        th= User.t :role_type
        th= t :operation
    tbody
      - @users.each do |user|
        tr
          td
            = user.info
            - if user.role_type_super_admin? || user.role_type_school_admin?
              i.fa.fa-user.push-5-l
          td = boolean_icon user.active
          td = user.uid
          td = user.school
          td = truncate_str user.school_names.join(','), user.school_names.join('<br/>')
          td = user.trainee_title
          td = user.role_type_text
          td
            = link_to_dialog t(:view),  user, class: 'btn btn-info btn-xs'
            = link_to_dialog t(:edit), edit_user_path(user), class: 'btn btn-primary btn-xs push-5-l'
            /= link_to (user.active? ? '禁用' : '启用'), user_path(user, user: {active: !user.active?}),
            /        method: :put, class: "btn btn-#{user.active? ? 'danger' : 'warning'} btn-xs push-5-l"
  = paginate @users